<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('帖子举报列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								帖子ID：<input type="text" name="postId"/>
							</li>



							<li>
								举报人昵称：<input type="text" name="params[complainUserName]"/>
							</li>



							<li class="select-time">
								<label>举报日期： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>



							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search" id="listSearch"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">

				<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="postComplain:postComplain:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="postComplain:postComplain:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('postComplain:postComplain:edit')}]];
        var removeFlag = [[${@permission.hasPermi('postComplain:postComplain:remove')}]];
        var prefix = ctx + "postComplain/postComplain";

        $(function() {
            var options = {
                url: prefix + "/recordList",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "帖子举报",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '',
					visible: false
				},
				{
					field : 'postId', 
					title : '帖子ID',
					sortable: true
				},
				{
					field : 'complainContent', 
					title : '举报内容',
					sortable: true
				},

					{
						field : 'complainUserName',
						title : '举报人昵称',
						sortable: true
					},


					{
						title: '审核状态',
						formatter: function(value, row, index) {
							if(row.complainVerify==0){
								return "待审核";
							} else if(row.complainVerify==1){
								return "忽略";
							} else if(row.complainVerify==2){
								return "隐藏";
							}
						}
					},

				{
					field : 'createDate', 
					title : '建立日期',
					sortable: true
				},

		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];

						actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="topicComplainUpdate(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');

						actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');


                        return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });

		function ignoreVerify(id) {
			$.modal.confirm("是否确认忽略举报？", function () {
				var url = prefix + "/ignoreVerify";
				var data = {"id": id};
				$.operate.submit(url, "post", "json", data);
				var buy = document.getElementById('listSearch');//给你的a标签加一个id :btnBuy
				buy.click();
			});
		}

		function hideVerify(id) {
			$.modal.confirm("是否确认隐藏该条动态？", function () {
				var url = prefix + "/hideVerify";
				var data = {"id": id};
				$.operate.submit(url, "post", "json", data);
				var buy = document.getElementById('listSearch');//给你的a标签加一个id :btnBuy
				buy.click();
			});
		}

		function topicComplainUpdate(id) {
			var options = {
				title: $.table._option.modalName + "详情",
				width: 1300,
				height: 500,
				url: prefix + "/edit/" + id,
				skin: 'layui-layer-gray',
				btn: ['关闭'],
				yes: function (index, layero) {
					layer.close(index);
				}
			};
			$.modal.openOptions(options);
		}
    </script>
</body>
</html>